import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";
import HomeView from "../views/HomeView.vue";

const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    redirect: "/home/index",
  },
  {
    path: "/home",
    name: "home",
    component: HomeView,
    children: [
      {
        path: "index",
        component: () => import("../views/index/IndexView.vue"),
      },
      // 商城
      {
        path: "shopping",
        component: () => import("../views/shopping/ShopView.vue"),
      },
      // 商品详情
      {
        path: "productdetails",
        component: () => import("../views/shopping/ProductDetails.vue"),
      },
      //订单
      {
        path: "order",
        component: () => import("../views/order/OrderForGoods.vue"),
      },
      // 订单详情
      {
        path: "orderdetails",
        component: () => import("../views/shopping/OrderDetails.vue"),
      }  ,
      //确认订单
      {
        path: "conorder",
        component: () => import("../views/shopping/ConfirmOrrder.vue"),
      },
      {
        path: "me",
        component: () => import("../views/me/MeView.vue"),
      },
      {
        path: "setup",
        component: () => import("../views/me/SetUp.vue"),
      },
      {
        path: "adress",
        component: () => import("../views/adress/myAdress.vue"),
      },
      {
        path: "add",
        component: () => import("../views/adress/addAdress.vue"),
      },
      {
        path: "edit",
        component: () => import("../views/adress/editAdress.vue"),
      },
      {
        path: "phone",
        component: () => import("../views/me/phoneView.vue"),
      },
      {
        path: "pwd",
        component: () => import("../views/me/pwdView.vue"),
      },
      {
        path: "updatepwd",
        component: () => import("../views/me/updatePwd.vue"),
      },
      {
        path: "account",
        component: () => import("../views/me/AccountView.vue"),
      }
    ],
  },
  {
    path: "/about",
    name: "about",
    component: () => import("../views/AboutView.vue"),
  },{
    path: "/login",
    name: "login",
    component: () => import("../views/login/LoginView.vue"),
    
  },{
    path: "/register",
    name: "register",
    component: () => import("../views/login/RegisterView.vue"),
  },
  {
    path:"/forget",
    component: () => import("../views/login/ForgetView.vue"),
  },{
    path:"/forgetUpdate",
    component: () => import("../views/login/ForgetUpDataView.vue"),
  }
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
});

export default router;
